// pages/news/news.js
Page({
    /**
     * 页面的初始数据
     */
    data: {
        messages: []
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        let obj = this.data.messages;
        for (var i = 0; i < 20; i++) {
            obj.push({
                title: "免费送票! 超有内涵的门票",
                data: i,
                src: "https://picsum.photos/id/258/400/300",
                desc: "最糟糕的, 也许就是最幸运的"
            });
        }
        this.setData({
            messages: obj
        });
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {
        const query = wx.createSelectorQuery();
        query.select("#bottom").boundingClientRect();
        query.exec(res => wx.pageScrollTo({
            scrollTop: res[0].top + 0
        }));
    }
});